<script>
import { manuTypeMap } from '@/utils/service.js'
export default {
  name: 'ArticleTitle',

  functional: true,

  props: {
    info: { type: Object, default: () => ({}) },
  },

  render(h, context) {
    const info = context.props.info
    const type = info.contextType
    let icon = ''
    if (['IMAGE', 'VIDEO'].includes(type)) {
      icon = (
        <icon-button
          width="14"
          class="flex-shrink-0 ml4 cursor-default"
          icon={manuTypeMap[type].icon}
          title={manuTypeMap[type].title}
          activated={false}
        ></icon-button>
      )
    }

    return (
      <div class="d-flex">
        {/* <router-link class="ellipsis" title={info.title} to={{ name: '', query: { id: info.id } }}> */}
        <a class="ellipsis" title={info.title} href={info.url || ''}>
          {info.title}
        </a>
        {icon}
      </div>
    )
  },
}
</script>

<style lang="less" scoped></style>
